<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>统战成员学习平台</title>
    <link rel="stylesheet" type="text/css" href="../../css/base.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
</head>
<body>
<div id='app' style="display:none" v-show="true">
    <div class="exam_start">
        <div class="exam_info">
            <p class="ui_border_b">{{detail.ruleName}}</p>
            <ul class="ui_border_b">
                <li class="ui_border_b">试题数量：{{detail.totalNum}}</li>
                <li class="ui_border_b">考试时间：{{detail.examTime}}min</li>
                <li class="ui_border_b">考试总分：{{detail.fullmarks}}分</li>
                <li class="ui_border_b">合格分数：{{detail.qualified}}分</li>
                <li v-if="detail.flunknum!=1">提示：多次考试只记录最高成绩。</li>
                <li v-else>提示：只有一次机会，请慎重答题。</li>
            </ul>
        </div>
        <div v-if="(detail.flunknum == -1||detail.flunknum>0)" @click="exam()" tapmode="tap" class="big_btn yellow">开始考试</div>
        <div v-else tapmode="tap" class="big_btn">开始考试</div>
        <p class="exam_last">剩余次数：{{detail.flunknum === -1 ? '不限次数' : detail.flunknum}}</p>
    </div>
</div>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/layer_mobile/layer.js"></script>
<script type="text/javascript">
    new Vue({
        el: '#app',
        data: {
            scheduleId: 0,
            examId: 0,
            examName: '',
            detail: {}
        },
        mounted: function () {
            var $this = this;
            apiready = function () {
                api.parseTapmode();
                $this.examId = api.pageParam.examId;
                $this.scheduleId = api.pageParam.scheduleId;
                $this.examName = api.pageParam.examName;
                $this.init();
            }
        },
        methods: {
            init: function () {
                var $this = this;
                post('/client/schedule/selectExamRule', {
                    examRuleId: $this.examId,
                    scheduleId: $this.scheduleId
                }, function (ret) {
                    if (ret.isSuccess) {
                        $this.detail = ret.data;
                    } else {
                        msgUtil.toast({
                            msg: ret.message
                        })
                    }
                })
            },
            exam: function () {
                var $this = this;
                if ($this.detail.flunknum == -1 || $this.detail.flunknum > 0) {
                    msgUtil.confirm({
                        title: '提示',
                        msg: '答题过程中取消，成绩按0分计算！请您确认是否开始考试？',
                        buttons: ['确定', '取消'],
                        yes: function () {
                            openWin('exam_win', {
                                scheduleId: $this.scheduleId,
                                examId: $this.examId
                            })
                        }
                    });
                } else {
                    $this.showMessage("考试次数已用完！");
                }
            }
        }
    });
</script>
</body>
</html>
